package com.strategy.example;

import com.strategy.annotation.Strategy;
import com.strategy.core.AbstractStrategy;

import java.util.Map;

/**
 * 加法策略示例
 */
@Strategy(
        key = "calculator",
        version = "1.0.0",
        description = "加法计算策略：将输入值与参数value相加",
        isDefault = true
)
public class AddStrategy extends AbstractStrategy<Integer, Integer, Integer> {

    @Override
    public Integer execute(Integer input, Map<String, Integer> params) {
        if (params == null || !params.containsKey("value")) {
            throw new IllegalArgumentException("参数中必须包含value");
        }
        return input + params.get("value");
    }
}
